-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Populate fragments for polymorphic relations #14879
Conversation
@Convly how would this look in QS? Based on the way this is constructed it would mean being able to populate only specific components in a DZ? Does this break the existing logic? |
Codecov ReportBase: 59.61% // Head: 59.59% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #14879 +/- ##
==========================================
- Coverage 59.61% 59.59% -0.03%
==========================================
Files 1340 1340
Lines 32639 32655 +16
Branches 6225 6232 +7
==========================================
+ Hits 19459 19461 +2
- Misses 11316 11326 +10
- Partials 1864 1868 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Based on what JS showed me in a Discord voice call:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just missing some tests and a few comments but looks pretty good
packages/core/strapi/tests/api/populate/filtering/index.test.api.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me, and I don't have any thoughts beyond what others have already brought up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments but the is there 👌
packages/core/strapi/tests/api/populate/filtering/index.test.api.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice
This also does include a pretty good documentation, right? |
|
What does it do?
Add the possibility to fragment the populate query of polymorphic relations using the
populate.on
property.It's possible to use this syntax for dynamic zones and media to add more granularity & precision to the populate's queries.
Why is it needed?
Up until now, it was not possible to differentiate multiple entities attached to a polymorphic relation & apply different rules to them based on their type.
It was particularly an issue regarding dynamic zone population as it was thus impossible to apply different filters to different kinds of component structures.
How to test it?
examples/getstarted
applicationdz
attribute)http://localhost:1337/api/restaurants?populate[dz][on][default.dish]=true
You can also have variant such as
http://localhost:1337/api/restaurants?populate[dz][on][default.dish][fields]=name
on
property.Related issue(s)/PR(s)
fix #13220